import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { DomSanitizer } from "@angular/platform-browser";
declare var QRCode: any;
@Component({
  selector: 'app-preview',
  templateUrl: './preview.component.html',
  styleUrls: ['./preview.component.less']
})
export class PreviewComponent implements OnInit {
  url
  @ViewChild('qrcodedom') qrcodedom: any;
  constructor(private sanitizer: DomSanitizer) { }
  @Input() id = ""
  ngOnInit(): void {
    this.url = this.sanitizer.bypassSecurityTrustResourceUrl(`https://player.ysjlive.com/model/830ec1fd-dd98-4641-8c65-e3ef98419333/${this.id}?s=${new Date().getTime()}`);

  }
  ngAfterViewInit() {
    new QRCode(this.qrcodedom.nativeElement, {
      width: '200',
      height: '200'
    }).makeCode(this.url.changingThisBreaksApplicationSecurity);
  }
}
